#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int mima(const char* name,const char* key,unsigned int namelen,unsigned int keylen){    //账号密码登陆
    char rname[]={'x','y','y',0};//'3','1','6','4','8','6','2','6','9','1'
    char rkey[]={'1','2','3','4','5',0};
    int panduan1=0,panduan2=0;
    for (int i = 0,j=0; i < namelen,j<keylen; i++,j++){
        if((rname[i] != name[i]) || (strlen(rname) != namelen)){
                    printf("帐号未注册\n");
                    return 1;
        }
        else if((rkey[i] != key[i] ) || (strlen(rkey) != keylen)){                 
            printf("密码错误\n");
            return 1;
        } 
        else{
            printf("登陆成功\n");
            return 0;
        }       
    }      
}
int main(int argc,char* argv[])
{   
    const char* name=argv[1];        // 账号密码登陆
    const char* key=argv[2];
    int true=3;
    while(true){
        // printf("请输入用户名:");
        // scanf("%s",name);
        // printf("请输入密码:");
        // scanf("%s",key);
        int n=mima(name,key,strlen(name),strlen(key));
        if(n == 1){
            true--;
            printf("还有%d次操作机会",true);
        }
        else{
            true=0;
        }
    }
    

    return 0;
}